package method_student;

public class MethodDemo06 {
    public static void main(String[] args) {
        int[] arrs1 = {1, 2, 5};
        int[] arrs2 = {1, 3, 5};
        System.out.println(equals(arrs1, arrs2));
    }
    public static boolean equals(int[] arrs1, int[] arrs2){
        //当两个数组都为null时
        if(arrs1 == null && arrs2 == null){
            return true;
        }

        //判断其中是否有一个数组为null
        if(arrs1 == null || arrs2 == null){
            return false;
        }

        //判断数组长度是否一样
        if(arrs1.length != arrs2.length){
            return false;
        }

        //遍历每一个元素是否相等
        for (int i = 0; i < arrs1.length; i++) {
            if(arrs1[i] != arrs2[i]){
                return false;
            }
        }
        return true;
    }
}
